Skip to content

fix: resolve all failing tests across 5 utility modules#176

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/job-e2e-tier1-2292-1779439013
Open

fix: resolve all failing tests across 5 utility modules#176
stooit wants to merge 1 commit into
mainfrom
quantcode/job-e2e-tier1-2292-1779439013

Conversation

@stooit
Copy link
Copy Markdown
Contributor

@stooit stooit commented May 22, 2026

Summary

  • calculator.ts: Throw Error("Division by zero") instead of returning Infinity when dividing by zero
  • string-utils.ts: Fix wordCount to handle multiple consecutive spaces; implement truncate with word-boundary logic and "..." suffix
  • task-manager.ts: Implement remove, update, and sortBy methods
  • date-utils.ts: Use Math.round instead of Math.floor for relative day calculations (36h → "2 days ago")
  • validator.ts: Allow TLDs of 2+ characters in email validation; support ports on any hostname in URL validation

Test Results

All 60 tests pass across 5 test files with 70 expect() calls.

Assumptions

  • truncate uses word-boundary truncation where the "..." suffix counts toward maxLength
  • sortBy("priority") orders high > medium > low
  • sortBy("createdAt") orders oldest first
  • formatRelative uses Math.round for day rounding (consistent with test expectations)

- calculator: throw on division by zero instead of returning Infinity
- string-utils: handle multiple spaces in wordCount, implement truncate
- task-manager: implement remove, update, and sortBy methods
- date-utils: use Math.round instead of Math.floor for relative days
- validator: allow long TLDs in email, allow ports in URL validation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant